#include <my_head.h>


int main(int argc, char const *argv[])
{
    FILE*fp=fopen(argv[1],"a");
    if(NULL == fp)
        ERR_LOG("fopen error");
    time_t sec = 0;
    if(-1 == time(&sec))
        ERR_LOG("time error");
    struct tm *p = NULL;
    if(NULL == (p = localtime(&sec)))
        ERR_LOG("localtime error");
    while(1){
        time_t sec;
    fprintf(fp,"%04d-%02d-%02d %02d:%02d:%02d\n",
    p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, 
    p->tm_hour, p->tm_min, p->tm_sec);
    fflush(fp);
    printf("%04d-%02d-%02d %02d:%02d:%02d\n",
    p->tm_year + 1900, p->tm_mon + 1, p->tm_mday, 
    p->tm_hour, p->tm_min, p->tm_sec);
    sleep(1);

    }
    fclose(fp);
    return 0;
}
